package com.pi.pro.xcmg.am.was.web.report;

import com.pi.pro.xcmg.am.common.vo.report.*;

/**
 *
 */

import com.pi.pro.xcmg.am.common.vo.sys.Result;
import com.pi.wms.service.KanbanReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;


/**
 * 报表(LED屏) 功能
 */
@Slf4j
@RestController("reportOutboundReportContrller")
@RequestMapping("/api/wms/xcmg/report/kanban/outbound")
public class ReportOutboundController {

    @Autowired
    private KanbanReportService kanbanReportService;


    @RequestMapping(value="/summary",method = RequestMethod.POST)
    @ResponseBody
    public Result summary(@RequestBody ReportQueryDto queryParams){
        //
        Map<String, Object> query = new HashMap<>();
        query.put("divisioncode", queryParams.getDivisioncode());
        //
        OutboundSummaryDailyReportDto summaryInfo = null;
        summaryInfo = kanbanReportService.summaryOutboundDailyData(query);
        return new Result().success().data(summaryInfo);
    }


    @RequestMapping(value="/worklist",method = RequestMethod.POST)
    @ResponseBody
    public Result worklist(@RequestBody ReportQueryDto queryParams){
        //
        Map<String, Object> query = new HashMap<>();
        query.put("divisioncode", queryParams.getDivisioncode());
        List<OutboundWorklistDailyReportDto> docs =null;
        docs = this.kanbanReportService.outboundWorklistDailyData(query);
        return new Result().success().data(docs);
    }

    @RequestMapping(value="/abnormallist",method = RequestMethod.POST)
    @ResponseBody
    public Result abnormallist(@RequestBody ReportQueryDto queryParams){
        //
        Map<String, Object> query = new HashMap<>();
        query.put("divisioncode", queryParams.getDivisioncode());
        List<OutboundAbnormallistDailyReportDto> docs =null;
        docs = this.kanbanReportService.outboundAbnormallistDailyData(query);
        return new Result().success().data(docs);
    }


    @RequestMapping(value="/listdocumentdetails",method = RequestMethod.POST)
    @ResponseBody
    public Result listdocumentdetails(@RequestBody ReportPageQueryDto queryParams){
        //
        Map<String, Object> query = new HashMap<>();
        query.put("divisioncode", queryParams.getDivisioncode());
        //
        List<CommonDocumentDetailsDto> detailsData = null;
        detailsData =kanbanReportService.queryOutboundTodayDocumentData(query, queryParams);
        return new Result().success().data(detailsData);
    }

    @RequestMapping(value="/listfindocumentdetails",method = RequestMethod.POST)
    @ResponseBody
    public Result listfindocumentdetails(@RequestBody ReportPageQueryDto queryParams){
        //
        Map<String, Object> query = new HashMap<>();
        query.put("divisioncode", queryParams.getDivisioncode());
        //
        List<CommonDocumentDetailsDto> detailsData = null;
        detailsData =kanbanReportService.queryOutboundFinishedDocumentData(query, queryParams);
        return new Result().success().data(detailsData);
    }

    @RequestMapping(value="/listshortdocumentdetails",method = RequestMethod.POST)
    @ResponseBody
    public Result listshortagedocumentdetails(@RequestBody ReportPageQueryDto queryParams){
        //
        Map<String, Object> query = new HashMap<>();
        query.put("divisioncode", queryParams.getDivisioncode());
        //
        List<CommonDocumentDetailsDto> detailsData = null;
        detailsData =kanbanReportService.queryOutboundShortagedDocumentData(query, queryParams);
        return new Result().success().data(detailsData);
    }

    //出库-计划
    @RequestMapping(value="/listdocumentsum",method = RequestMethod.POST)
    @ResponseBody
    public Result listdocumentsum(@RequestBody ReportPageQueryDto queryParams){
        //
        Map<String, Object> query = new HashMap<>();
        query.put("divisioncode", queryParams.getDivisioncode());
        //
        List<CommonDocumentDetailsDto> detailsData = null;
        detailsData =kanbanReportService.queryOutboundDocumentSumData(query, queryParams);
        return new Result().success().data(detailsData);
    }

    //出库-已发货
    @RequestMapping(value="/listshipsum",method = RequestMethod.POST)
    @ResponseBody
    public Result listdocumentshipsum(@RequestBody ReportPageQueryDto queryParams){
        //
        Map<String, Object> query = new HashMap<>();
        query.put("divisioncode", queryParams.getDivisioncode());
        //
        List<CommonDocumentDetailsDto> detailsData = null;
        detailsData =kanbanReportService.queryOutboundDocumentShipSumData(query, queryParams);
        return new Result().success().data(detailsData);
    }


    @RequestMapping(value="/getworkdocumentdetails",method = RequestMethod.POST)
    @ResponseBody
    public Result getworkdocumentdetails(@RequestBody ReportPageQueryDto queryParams){
        //
        Map<String, Object> query = new HashMap<>();
        query.put("divisioncode", queryParams.getDivisioncode());
        query.put("documentnumber", queryParams.getDocumentnumber());
        //
        List<CommonDocumentDetailsDto> detailsData = null;
        detailsData =kanbanReportService.queryOutboundDocumentDetailsData(query, queryParams);
        return new Result().success().data(detailsData);
    }

    @RequestMapping(value="/getshortdocumentdetails",method = RequestMethod.POST)
    @ResponseBody
    public Result getshortagedocumentdetails(@RequestBody ReportPageQueryDto queryParams){
        //
        Map<String, Object> query = new HashMap<>();
        query.put("divisioncode", queryParams.getDivisioncode());
        query.put("documentnumber", queryParams.getDocumentnumber());
        //
        List<CommonDocumentDetailsDto> detailsData = null;
        detailsData =kanbanReportService.queryOutboundShortageDocumentDetailsData(query, queryParams);
        return new Result().success().data(detailsData);
    }



}
